// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.

#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#![no_implicit_prelude]
extern crate async_trait;
extern crate bytes;
extern crate gax;
extern crate gaxi;
extern crate gtype;
extern crate lazy_static;
extern crate longrunning;
extern crate lro;
extern crate reqwest;
extern crate serde;
extern crate serde_json;
extern crate serde_with;
extern crate std;
extern crate tracing;
extern crate wkt;

mod debug;
mod deserialize;
mod serialize;

/// Represents the metadata of the long-running operation.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct OperationMetadata {
    /// Output only. The time the operation was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The time the operation finished running.
    pub end_time: std::option::Option<wkt::Timestamp>,

    /// Output only. Server-defined resource path for the target of the
    pub target: std::string::String,

    /// Output only. Name of the verb executed by the operation.
    pub verb: std::string::String,

    /// Output only. Human-readable status of the operation, if any.
    pub status_message: std::string::String,

    /// Output only. Identifies whether the user has requested cancellation
    /// of the operation. Operations that have successfully been cancelled
    /// have [Operation.error][] value with a
    /// [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
    /// `Code.CANCELLED`.
    ///
    /// [google.rpc.Status.code]: rpc::model::Status::code
    pub requested_cancellation: bool,

    /// Output only. API version used to start the operation.
    pub api_version: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl OperationMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
    pub fn set_end_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.end_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.end_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [target][crate::model::OperationMetadata::target].
    pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.target = v.into();
        self
    }

    /// Sets the value of [verb][crate::model::OperationMetadata::verb].
    pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.verb = v.into();
        self
    }

    /// Sets the value of [status_message][crate::model::OperationMetadata::status_message].
    pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.status_message = v.into();
        self
    }

    /// Sets the value of [requested_cancellation][crate::model::OperationMetadata::requested_cancellation].
    pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.requested_cancellation = v.into();
        self
    }

    /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
    pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.api_version = v.into();
        self
    }
}

impl wkt::message::Message for OperationMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.v3.OperationMetadata"
    }
}

/// IAM policy binding resource.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PolicyBinding {
    /// Identifier. The name of the policy binding, in the format
    /// `{binding_parent/locations/{location}/policyBindings/{policy_binding_id}`.
    /// The binding parent is the closest Resource Manager resource (project,
    /// folder, or organization) to the binding target.
    ///
    /// Format:
    ///
    /// * `projects/{project_id}/locations/{location}/policyBindings/{policy_binding_id}`
    /// * `projects/{project_number}/locations/{location}/policyBindings/{policy_binding_id}`
    /// * `folders/{folder_id}/locations/{location}/policyBindings/{policy_binding_id}`
    /// * `organizations/{organization_id}/locations/{location}/policyBindings/{policy_binding_id}`
    pub name: std::string::String,

    /// Output only. The globally unique ID of the policy binding. Assigned when
    /// the policy binding is created.
    pub uid: std::string::String,

    /// Optional. The etag for the policy binding.
    /// If this is provided on update, it must match the server's etag.
    pub etag: std::string::String,

    /// Optional. The description of the policy binding. Must be less than or equal
    /// to 63 characters.
    pub display_name: std::string::String,

    /// Optional. User-defined annotations. See
    /// <https://google.aip.dev/148#annotations> for more details such as format and
    /// size limitations
    pub annotations: std::collections::HashMap<std::string::String, std::string::String>,

    /// Required. Immutable. Target is the full resource name of the resource to
    /// which the policy will be bound. Immutable once set.
    pub target: std::option::Option<crate::model::policy_binding::Target>,

    /// Immutable. The kind of the policy to attach in this binding. This field
    /// must be one of the following:
    ///
    /// - Left empty (will be automatically set to the policy kind)
    /// - The input policy kind
    pub policy_kind: crate::model::policy_binding::PolicyKind,

    /// Required. Immutable. The resource name of the policy to be bound. The
    /// binding parent and policy must belong to the same organization.
    pub policy: std::string::String,

    /// Output only. The globally unique ID of the policy to be bound.
    pub policy_uid: std::string::String,

    /// Optional. The condition to apply to the policy binding. When set, the
    /// `expression` field in the `Expr` must include from 1 to 10 subexpressions,
    /// joined by the
    /// "||"(Logical OR), "&&"(Logical AND) or "!"(Logical NOT) operators and
    /// cannot contain more than 250 characters.
    ///
    /// The condition is currently only supported when bound to policies of kind
    /// principal access boundary.
    ///
    /// When the bound policy is a principal access boundary policy, the only
    /// supported attributes in any subexpression are `principal.type` and
    /// `principal.subject`. An example expression is: "principal.type ==
    /// 'iam.googleapis.com/ServiceAccount'" or "principal.subject ==
    /// 'bob@example.com'".
    ///
    /// Allowed operations for `principal.subject`:
    ///
    /// - `principal.subject == <principal subject string>`
    /// - `principal.subject != <principal subject string>`
    /// - `principal.subject in [<list of principal subjects>]`
    /// - `principal.subject.startsWith(<string>)`
    /// - `principal.subject.endsWith(<string>)`
    ///
    /// Allowed operations for `principal.type`:
    ///
    /// - `principal.type == <principal type string>`
    /// - `principal.type != <principal type string>`
    /// - `principal.type in [<list of principal types>]`
    ///
    /// Supported principal types are Workspace, Workforce Pool, Workload Pool and
    /// Service Account. Allowed string must be one of:
    ///
    /// - iam.googleapis.com/WorkspaceIdentity
    /// - iam.googleapis.com/WorkforcePoolIdentity
    /// - iam.googleapis.com/WorkloadPoolIdentity
    /// - iam.googleapis.com/ServiceAccount
    pub condition: std::option::Option<gtype::model::Expr>,

    /// Output only. The time when the policy binding was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The time when the policy binding was most recently updated.
    pub update_time: std::option::Option<wkt::Timestamp>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl PolicyBinding {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::PolicyBinding::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [uid][crate::model::PolicyBinding::uid].
    pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.uid = v.into();
        self
    }

    /// Sets the value of [etag][crate::model::PolicyBinding::etag].
    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.etag = v.into();
        self
    }

    /// Sets the value of [display_name][crate::model::PolicyBinding::display_name].
    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.display_name = v.into();
        self
    }

    /// Sets the value of [annotations][crate::model::PolicyBinding::annotations].
    pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [target][crate::model::PolicyBinding::target].
    pub fn set_target<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::policy_binding::Target>,
    {
        self.target = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [target][crate::model::PolicyBinding::target].
    pub fn set_or_clear_target<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::policy_binding::Target>,
    {
        self.target = v.map(|x| x.into());
        self
    }

    /// Sets the value of [policy_kind][crate::model::PolicyBinding::policy_kind].
    pub fn set_policy_kind<T: std::convert::Into<crate::model::policy_binding::PolicyKind>>(
        mut self,
        v: T,
    ) -> Self {
        self.policy_kind = v.into();
        self
    }

    /// Sets the value of [policy][crate::model::PolicyBinding::policy].
    pub fn set_policy<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.policy = v.into();
        self
    }

    /// Sets the value of [policy_uid][crate::model::PolicyBinding::policy_uid].
    pub fn set_policy_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.policy_uid = v.into();
        self
    }

    /// Sets the value of [condition][crate::model::PolicyBinding::condition].
    pub fn set_condition<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<gtype::model::Expr>,
    {
        self.condition = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [condition][crate::model::PolicyBinding::condition].
    pub fn set_or_clear_condition<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<gtype::model::Expr>,
    {
        self.condition = v.map(|x| x.into());
        self
    }

    /// Sets the value of [create_time][crate::model::PolicyBinding::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::PolicyBinding::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::PolicyBinding::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::PolicyBinding::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for PolicyBinding {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.v3.PolicyBinding"
    }
}

/// Defines additional types related to [PolicyBinding].
pub mod policy_binding {
    #[allow(unused_imports)]
    use super::*;

    /// Target is the full resource name of the resource to which the policy will
    /// be bound. Immutable once set.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct Target {
        /// The different types of targets that can be bound to a policy.
        pub target: std::option::Option<crate::model::policy_binding::target::Target>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl Target {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [target][crate::model::policy_binding::Target::target].
        ///
        /// Note that all the setters affecting `target` are mutually
        /// exclusive.
        pub fn set_target<
            T: std::convert::Into<std::option::Option<crate::model::policy_binding::target::Target>>,
        >(
            mut self,
            v: T,
        ) -> Self {
            self.target = v.into();
            self
        }

        /// The value of [target][crate::model::policy_binding::Target::target]
        /// if it holds a `PrincipalSet`, `None` if the field is not set or
        /// holds a different branch.
        pub fn principal_set(&self) -> std::option::Option<&std::string::String> {
            #[allow(unreachable_patterns)]
            self.target.as_ref().and_then(|v| match v {
                crate::model::policy_binding::target::Target::PrincipalSet(v) => {
                    std::option::Option::Some(v)
                }
                _ => std::option::Option::None,
            })
        }

        /// Sets the value of [target][crate::model::policy_binding::Target::target]
        /// to hold a `PrincipalSet`.
        ///
        /// Note that all the setters affecting `target` are
        /// mutually exclusive.
        pub fn set_principal_set<T: std::convert::Into<std::string::String>>(
            mut self,
            v: T,
        ) -> Self {
            self.target = std::option::Option::Some(
                crate::model::policy_binding::target::Target::PrincipalSet(v.into()),
            );
            self
        }
    }

    impl wkt::message::Message for Target {
        fn typename() -> &'static str {
            "type.googleapis.com/google.iam.v3.PolicyBinding.Target"
        }
    }

    /// Defines additional types related to [Target].
    pub mod target {
        #[allow(unused_imports)]
        use super::*;

        /// The different types of targets that can be bound to a policy.
        #[derive(Clone, Debug, PartialEq)]
        #[non_exhaustive]
        pub enum Target {
            /// Immutable. Full Resource Name used for principal access boundary policy
            /// bindings. The principal set must be directly parented by the policy
            /// binding's parent or same as the parent if the target is a
            /// project/folder/organization.
            ///
            /// Examples:
            ///
            /// * For binding's parented by an organization:
            ///   * Organization:
            ///     `//cloudresourcemanager.googleapis.com/organizations/ORGANIZATION_ID`
            ///   * Workforce Identity:
            ///     `//iam.googleapis.com/locations/global/workforcePools/WORKFORCE_POOL_ID`
            ///   * Workspace Identity:
            ///     `//iam.googleapis.com/locations/global/workspace/WORKSPACE_ID`
            /// * For binding's parented by a folder:
            ///   * Folder:
            ///     `//cloudresourcemanager.googleapis.com/folders/FOLDER_ID`
            /// * For binding's parented by a project:
            ///   * Project:
            ///     * `//cloudresourcemanager.googleapis.com/projects/PROJECT_NUMBER`
            ///     * `//cloudresourcemanager.googleapis.com/projects/PROJECT_ID`
            ///   * Workload Identity Pool:
            ///     `//iam.googleapis.com/projects/PROJECT_NUMBER/locations/LOCATION/workloadIdentityPools/WORKLOAD_POOL_ID`
            PrincipalSet(std::string::String),
        }
    }

    /// Different policy kinds supported in this binding.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum PolicyKind {
        /// Unspecified policy kind; Not a valid state
        Unspecified,
        /// Principal access boundary policy kind
        PrincipalAccessBoundary,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [PolicyKind::value] or
        /// [PolicyKind::name].
        UnknownValue(policy_kind::UnknownValue),
    }

    #[doc(hidden)]
    pub mod policy_kind {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl PolicyKind {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::PrincipalAccessBoundary => std::option::Option::Some(1),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("POLICY_KIND_UNSPECIFIED"),
                Self::PrincipalAccessBoundary => {
                    std::option::Option::Some("PRINCIPAL_ACCESS_BOUNDARY")
                }
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for PolicyKind {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for PolicyKind {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for PolicyKind {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::PrincipalAccessBoundary,
                _ => Self::UnknownValue(policy_kind::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for PolicyKind {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "POLICY_KIND_UNSPECIFIED" => Self::Unspecified,
                "PRINCIPAL_ACCESS_BOUNDARY" => Self::PrincipalAccessBoundary,
                _ => Self::UnknownValue(policy_kind::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for PolicyKind {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::PrincipalAccessBoundary => serializer.serialize_i32(1),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for PolicyKind {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<PolicyKind>::new(
                ".google.iam.v3.PolicyBinding.PolicyKind",
            ))
        }
    }
}

/// Request message for CreatePolicyBinding method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreatePolicyBindingRequest {
    /// Required. The parent resource where this policy binding will be created.
    /// The binding parent is the closest Resource Manager resource (project,
    /// folder or organization) to the binding target.
    ///
    /// Format:
    ///
    /// * `projects/{project_id}/locations/{location}`
    /// * `projects/{project_number}/locations/{location}`
    /// * `folders/{folder_id}/locations/{location}`
    /// * `organizations/{organization_id}/locations/{location}`
    pub parent: std::string::String,

    /// Required. The ID to use for the policy binding, which will become the final
    /// component of the policy binding's resource name.
    ///
    /// This value must start with a lowercase letter followed by up to 62
    /// lowercase letters, numbers, hyphens, or dots. Pattern,
    /// /[a-z][a-z0-9-\.]{2,62}/.
    pub policy_binding_id: std::string::String,

    /// Required. The policy binding to create.
    pub policy_binding: std::option::Option<crate::model::PolicyBinding>,

    /// Optional. If set, validate the request and preview the creation, but do not
    /// actually post it.
    pub validate_only: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreatePolicyBindingRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreatePolicyBindingRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [policy_binding_id][crate::model::CreatePolicyBindingRequest::policy_binding_id].
    pub fn set_policy_binding_id<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.policy_binding_id = v.into();
        self
    }

    /// Sets the value of [policy_binding][crate::model::CreatePolicyBindingRequest::policy_binding].
    pub fn set_policy_binding<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::PolicyBinding>,
    {
        self.policy_binding = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [policy_binding][crate::model::CreatePolicyBindingRequest::policy_binding].
    pub fn set_or_clear_policy_binding<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::PolicyBinding>,
    {
        self.policy_binding = v.map(|x| x.into());
        self
    }

    /// Sets the value of [validate_only][crate::model::CreatePolicyBindingRequest::validate_only].
    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.validate_only = v.into();
        self
    }
}

impl wkt::message::Message for CreatePolicyBindingRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.v3.CreatePolicyBindingRequest"
    }
}

/// Request message for GetPolicyBinding method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetPolicyBindingRequest {
    /// Required. The name of the policy binding to retrieve.
    ///
    /// Format:
    ///
    /// * `projects/{project_id}/locations/{location}/policyBindings/{policy_binding_id}`
    /// * `projects/{project_number}/locations/{location}/policyBindings/{policy_binding_id}`
    /// * `folders/{folder_id}/locations/{location}/policyBindings/{policy_binding_id}`
    /// * `organizations/{organization_id}/locations/{location}/policyBindings/{policy_binding_id}`
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetPolicyBindingRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetPolicyBindingRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetPolicyBindingRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.v3.GetPolicyBindingRequest"
    }
}

/// Request message for UpdatePolicyBinding method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdatePolicyBindingRequest {
    /// Required. The policy binding to update.
    ///
    /// The policy binding's `name` field is used to identify the policy binding to
    /// update.
    pub policy_binding: std::option::Option<crate::model::PolicyBinding>,

    /// Optional. If set, validate the request and preview the update, but do not
    /// actually post it.
    pub validate_only: bool,

    /// Optional. The list of fields to update
    pub update_mask: std::option::Option<wkt::FieldMask>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdatePolicyBindingRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [policy_binding][crate::model::UpdatePolicyBindingRequest::policy_binding].
    pub fn set_policy_binding<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::PolicyBinding>,
    {
        self.policy_binding = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [policy_binding][crate::model::UpdatePolicyBindingRequest::policy_binding].
    pub fn set_or_clear_policy_binding<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::PolicyBinding>,
    {
        self.policy_binding = v.map(|x| x.into());
        self
    }

    /// Sets the value of [validate_only][crate::model::UpdatePolicyBindingRequest::validate_only].
    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.validate_only = v.into();
        self
    }

    /// Sets the value of [update_mask][crate::model::UpdatePolicyBindingRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdatePolicyBindingRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for UpdatePolicyBindingRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.v3.UpdatePolicyBindingRequest"
    }
}

/// Request message for DeletePolicyBinding method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeletePolicyBindingRequest {
    /// Required. The name of the policy binding to delete.
    ///
    /// Format:
    ///
    /// * `projects/{project_id}/locations/{location}/policyBindings/{policy_binding_id}`
    /// * `projects/{project_number}/locations/{location}/policyBindings/{policy_binding_id}`
    /// * `folders/{folder_id}/locations/{location}/policyBindings/{policy_binding_id}`
    /// * `organizations/{organization_id}/locations/{location}/policyBindings/{policy_binding_id}`
    pub name: std::string::String,

    /// Optional. The etag of the policy binding.
    /// If this is provided, it must match the server's etag.
    pub etag: std::string::String,

    /// Optional. If set, validate the request and preview the deletion, but do not
    /// actually post it.
    pub validate_only: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeletePolicyBindingRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeletePolicyBindingRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [etag][crate::model::DeletePolicyBindingRequest::etag].
    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.etag = v.into();
        self
    }

    /// Sets the value of [validate_only][crate::model::DeletePolicyBindingRequest::validate_only].
    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.validate_only = v.into();
        self
    }
}

impl wkt::message::Message for DeletePolicyBindingRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.v3.DeletePolicyBindingRequest"
    }
}

/// Request message for ListPolicyBindings method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListPolicyBindingsRequest {
    /// Required. The parent resource, which owns the collection of policy
    /// bindings.
    ///
    /// Format:
    ///
    /// * `projects/{project_id}/locations/{location}`
    /// * `projects/{project_number}/locations/{location}`
    /// * `folders/{folder_id}/locations/{location}`
    /// * `organizations/{organization_id}/locations/{location}`
    pub parent: std::string::String,

    /// Optional. The maximum number of policy bindings to return. The service may
    /// return fewer than this value.
    ///
    /// If unspecified, at most 50 policy bindings will be returned.
    /// The maximum value is 1000; values above 1000 will be coerced to 1000.
    pub page_size: i32,

    /// Optional. A page token, received from a previous `ListPolicyBindings` call.
    /// Provide this to retrieve the subsequent page.
    ///
    /// When paginating, all other parameters provided to `ListPolicyBindings` must
    /// match the call that provided the page token.
    pub page_token: std::string::String,

    /// Optional. An expression for filtering the results of the request. Filter
    /// rules are case insensitive. Some eligible fields for filtering are:
    ///
    /// + `target`
    /// + `policy`
    ///
    /// Some examples of filter queries:
    ///
    /// * `target:ex*`: The binding target's name starts with "ex".
    /// * `target:example`: The binding target's name is `example`.
    /// * `policy:example`: The binding policy's name is `example`.
    pub filter: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListPolicyBindingsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListPolicyBindingsRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListPolicyBindingsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListPolicyBindingsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::ListPolicyBindingsRequest::filter].
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }
}

impl wkt::message::Message for ListPolicyBindingsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.v3.ListPolicyBindingsRequest"
    }
}

/// Response message for ListPolicyBindings method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListPolicyBindingsResponse {
    /// The policy bindings from the specified parent.
    pub policy_bindings: std::vec::Vec<crate::model::PolicyBinding>,

    /// Optional. A token, which can be sent as `page_token` to retrieve the next
    /// page. If this field is omitted, there are no subsequent pages.
    pub next_page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListPolicyBindingsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [policy_bindings][crate::model::ListPolicyBindingsResponse::policy_bindings].
    pub fn set_policy_bindings<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::PolicyBinding>,
    {
        use std::iter::Iterator;
        self.policy_bindings = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListPolicyBindingsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListPolicyBindingsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.v3.ListPolicyBindingsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListPolicyBindingsResponse {
    type PageItem = crate::model::PolicyBinding;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.policy_bindings
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Request message for SearchTargetPolicyBindings method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SearchTargetPolicyBindingsRequest {
    /// Required. The target resource, which is bound to the policy in the binding.
    ///
    /// Format:
    ///
    /// * `//iam.googleapis.com/locations/global/workforcePools/POOL_ID`
    /// * `//iam.googleapis.com/projects/PROJECT_NUMBER/locations/global/workloadIdentityPools/POOL_ID`
    /// * `//iam.googleapis.com/locations/global/workspace/WORKSPACE_ID`
    /// * `//cloudresourcemanager.googleapis.com/projects/{project_number}`
    /// * `//cloudresourcemanager.googleapis.com/folders/{folder_id}`
    /// * `//cloudresourcemanager.googleapis.com/organizations/{organization_id}`
    pub target: std::string::String,

    /// Optional. The maximum number of policy bindings to return. The service may
    /// return fewer than this value.
    ///
    /// If unspecified, at most 50 policy bindings will be returned.
    /// The maximum value is 1000; values above 1000 will be coerced to 1000.
    pub page_size: i32,

    /// Optional. A page token, received from a previous
    /// `SearchTargetPolicyBindingsRequest` call. Provide this to retrieve the
    /// subsequent page.
    ///
    /// When paginating, all other parameters provided to
    /// `SearchTargetPolicyBindingsRequest` must match the call that provided the
    /// page token.
    pub page_token: std::string::String,

    /// Required. The parent resource where this search will be performed. This
    /// should be the nearest Resource Manager resource (project, folder, or
    /// organization) to the target.
    ///
    /// Format:
    ///
    /// * `projects/{project_id}/locations/{location}`
    /// * `projects/{project_number}/locations/{location}`
    /// * `folders/{folder_id}/locations/{location}`
    /// * `organizations/{organization_id}/locations/{location}`
    pub parent: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl SearchTargetPolicyBindingsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [target][crate::model::SearchTargetPolicyBindingsRequest::target].
    pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.target = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::SearchTargetPolicyBindingsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::SearchTargetPolicyBindingsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [parent][crate::model::SearchTargetPolicyBindingsRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }
}

impl wkt::message::Message for SearchTargetPolicyBindingsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.v3.SearchTargetPolicyBindingsRequest"
    }
}

/// Response message for SearchTargetPolicyBindings method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SearchTargetPolicyBindingsResponse {
    /// The policy bindings bound to the specified target.
    pub policy_bindings: std::vec::Vec<crate::model::PolicyBinding>,

    /// Optional. A token, which can be sent as `page_token` to retrieve the next
    /// page. If this field is omitted, there are no subsequent pages.
    pub next_page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl SearchTargetPolicyBindingsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [policy_bindings][crate::model::SearchTargetPolicyBindingsResponse::policy_bindings].
    pub fn set_policy_bindings<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::PolicyBinding>,
    {
        use std::iter::Iterator;
        self.policy_bindings = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::SearchTargetPolicyBindingsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }
}

impl wkt::message::Message for SearchTargetPolicyBindingsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.v3.SearchTargetPolicyBindingsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for SearchTargetPolicyBindingsResponse {
    type PageItem = crate::model::PolicyBinding;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.policy_bindings
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Request message for CreatePrincipalAccessBoundaryPolicyRequest method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreatePrincipalAccessBoundaryPolicyRequest {
    /// Required. The parent resource where this principal access boundary policy
    /// will be created. Only organizations are supported.
    ///
    /// Format:
    /// `organizations/{organization_id}/locations/{location}`
    pub parent: std::string::String,

    /// Required. The ID to use for the principal access boundary policy, which
    /// will become the final component of the principal access boundary policy's
    /// resource name.
    ///
    /// This value must start with a lowercase letter followed by up to 62
    /// lowercase letters, numbers, hyphens, or dots. Pattern,
    /// /[a-z][a-z0-9-\.]{2,62}/.
    pub principal_access_boundary_policy_id: std::string::String,

    /// Required. The principal access boundary policy to create.
    pub principal_access_boundary_policy:
        std::option::Option<crate::model::PrincipalAccessBoundaryPolicy>,

    /// Optional. If set, validate the request and preview the creation, but do not
    /// actually post it.
    pub validate_only: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreatePrincipalAccessBoundaryPolicyRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreatePrincipalAccessBoundaryPolicyRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [principal_access_boundary_policy_id][crate::model::CreatePrincipalAccessBoundaryPolicyRequest::principal_access_boundary_policy_id].
    pub fn set_principal_access_boundary_policy_id<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.principal_access_boundary_policy_id = v.into();
        self
    }

    /// Sets the value of [principal_access_boundary_policy][crate::model::CreatePrincipalAccessBoundaryPolicyRequest::principal_access_boundary_policy].
    pub fn set_principal_access_boundary_policy<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::PrincipalAccessBoundaryPolicy>,
    {
        self.principal_access_boundary_policy = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [principal_access_boundary_policy][crate::model::CreatePrincipalAccessBoundaryPolicyRequest::principal_access_boundary_policy].
    pub fn set_or_clear_principal_access_boundary_policy<T>(
        mut self,
        v: std::option::Option<T>,
    ) -> Self
    where
        T: std::convert::Into<crate::model::PrincipalAccessBoundaryPolicy>,
    {
        self.principal_access_boundary_policy = v.map(|x| x.into());
        self
    }

    /// Sets the value of [validate_only][crate::model::CreatePrincipalAccessBoundaryPolicyRequest::validate_only].
    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.validate_only = v.into();
        self
    }
}

impl wkt::message::Message for CreatePrincipalAccessBoundaryPolicyRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.v3.CreatePrincipalAccessBoundaryPolicyRequest"
    }
}

/// Request message for GetPrincipalAccessBoundaryPolicy method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetPrincipalAccessBoundaryPolicyRequest {
    /// Required. The name of the principal access boundary policy to retrieve.
    ///
    /// Format:
    /// `organizations/{organization_id}/locations/{location}/principalAccessBoundaryPolicies/{principal_access_boundary_policy_id}`
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetPrincipalAccessBoundaryPolicyRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetPrincipalAccessBoundaryPolicyRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetPrincipalAccessBoundaryPolicyRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.v3.GetPrincipalAccessBoundaryPolicyRequest"
    }
}

/// Request message for UpdatePrincipalAccessBoundaryPolicy method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdatePrincipalAccessBoundaryPolicyRequest {
    /// Required. The principal access boundary policy to update.
    ///
    /// The principal access boundary policy's `name` field is used to identify the
    /// policy to update.
    pub principal_access_boundary_policy:
        std::option::Option<crate::model::PrincipalAccessBoundaryPolicy>,

    /// Optional. If set, validate the request and preview the update, but do not
    /// actually post it.
    pub validate_only: bool,

    /// Optional. The list of fields to update
    pub update_mask: std::option::Option<wkt::FieldMask>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdatePrincipalAccessBoundaryPolicyRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [principal_access_boundary_policy][crate::model::UpdatePrincipalAccessBoundaryPolicyRequest::principal_access_boundary_policy].
    pub fn set_principal_access_boundary_policy<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::PrincipalAccessBoundaryPolicy>,
    {
        self.principal_access_boundary_policy = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [principal_access_boundary_policy][crate::model::UpdatePrincipalAccessBoundaryPolicyRequest::principal_access_boundary_policy].
    pub fn set_or_clear_principal_access_boundary_policy<T>(
        mut self,
        v: std::option::Option<T>,
    ) -> Self
    where
        T: std::convert::Into<crate::model::PrincipalAccessBoundaryPolicy>,
    {
        self.principal_access_boundary_policy = v.map(|x| x.into());
        self
    }

    /// Sets the value of [validate_only][crate::model::UpdatePrincipalAccessBoundaryPolicyRequest::validate_only].
    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.validate_only = v.into();
        self
    }

    /// Sets the value of [update_mask][crate::model::UpdatePrincipalAccessBoundaryPolicyRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdatePrincipalAccessBoundaryPolicyRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for UpdatePrincipalAccessBoundaryPolicyRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.v3.UpdatePrincipalAccessBoundaryPolicyRequest"
    }
}

/// Request message for DeletePrincipalAccessBoundaryPolicy method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeletePrincipalAccessBoundaryPolicyRequest {
    /// Required. The name of the principal access boundary policy to delete.
    ///
    /// Format:
    /// `organizations/{organization_id}/locations/{location}/principalAccessBoundaryPolicies/{principal_access_boundary_policy_id}`
    pub name: std::string::String,

    /// Optional. The etag of the principal access boundary policy.
    /// If this is provided, it must match the server's etag.
    pub etag: std::string::String,

    /// Optional. If set, validate the request and preview the deletion, but do not
    /// actually post it.
    pub validate_only: bool,

    /// Optional. If set to true, the request will force the deletion of the policy
    /// even if the policy is referenced in policy bindings.
    pub force: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeletePrincipalAccessBoundaryPolicyRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeletePrincipalAccessBoundaryPolicyRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [etag][crate::model::DeletePrincipalAccessBoundaryPolicyRequest::etag].
    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.etag = v.into();
        self
    }

    /// Sets the value of [validate_only][crate::model::DeletePrincipalAccessBoundaryPolicyRequest::validate_only].
    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.validate_only = v.into();
        self
    }

    /// Sets the value of [force][crate::model::DeletePrincipalAccessBoundaryPolicyRequest::force].
    pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.force = v.into();
        self
    }
}

impl wkt::message::Message for DeletePrincipalAccessBoundaryPolicyRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.v3.DeletePrincipalAccessBoundaryPolicyRequest"
    }
}

/// Request message for ListPrincipalAccessBoundaryPolicies method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListPrincipalAccessBoundaryPoliciesRequest {
    /// Required. The parent resource, which owns the collection of principal
    /// access boundary policies.
    ///
    /// Format:
    /// `organizations/{organization_id}/locations/{location}`
    pub parent: std::string::String,

    /// Optional. The maximum number of principal access boundary policies to
    /// return. The service may return fewer than this value.
    ///
    /// If unspecified, at most 50 principal access boundary policies will be
    /// returned. The maximum value is 1000; values above 1000 will be coerced to
    /// 1000.
    pub page_size: i32,

    /// Optional. A page token, received from a previous
    /// `ListPrincipalAccessBoundaryPolicies` call. Provide this to retrieve the
    /// subsequent page.
    ///
    /// When paginating, all other parameters provided to
    /// `ListPrincipalAccessBoundaryPolicies` must match the call that provided the
    /// page token.
    pub page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListPrincipalAccessBoundaryPoliciesRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListPrincipalAccessBoundaryPoliciesRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListPrincipalAccessBoundaryPoliciesRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListPrincipalAccessBoundaryPoliciesRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListPrincipalAccessBoundaryPoliciesRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.v3.ListPrincipalAccessBoundaryPoliciesRequest"
    }
}

/// Response message for ListPrincipalAccessBoundaryPolicies method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListPrincipalAccessBoundaryPoliciesResponse {
    /// The principal access boundary policies from the specified parent.
    pub principal_access_boundary_policies:
        std::vec::Vec<crate::model::PrincipalAccessBoundaryPolicy>,

    /// Optional. A token, which can be sent as `page_token` to retrieve the next
    /// page. If this field is omitted, there are no subsequent pages.
    pub next_page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListPrincipalAccessBoundaryPoliciesResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [principal_access_boundary_policies][crate::model::ListPrincipalAccessBoundaryPoliciesResponse::principal_access_boundary_policies].
    pub fn set_principal_access_boundary_policies<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::PrincipalAccessBoundaryPolicy>,
    {
        use std::iter::Iterator;
        self.principal_access_boundary_policies = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListPrincipalAccessBoundaryPoliciesResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListPrincipalAccessBoundaryPoliciesResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.v3.ListPrincipalAccessBoundaryPoliciesResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListPrincipalAccessBoundaryPoliciesResponse {
    type PageItem = crate::model::PrincipalAccessBoundaryPolicy;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.principal_access_boundary_policies
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Request message for SearchPrincipalAccessBoundaryPolicyBindings rpc.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SearchPrincipalAccessBoundaryPolicyBindingsRequest {
    /// Required. The name of the principal access boundary policy.
    /// Format:
    /// `organizations/{organization_id}/locations/{location}/principalAccessBoundaryPolicies/{principal_access_boundary_policy_id}`
    pub name: std::string::String,

    /// Optional. The maximum number of policy bindings to return. The service may
    /// return fewer than this value.
    ///
    /// If unspecified, at most 50 policy bindings will be returned.
    /// The maximum value is 1000; values above 1000 will be coerced to 1000.
    pub page_size: i32,

    /// Optional. A page token, received from a previous
    /// `SearchPrincipalAccessBoundaryPolicyBindingsRequest` call. Provide this to
    /// retrieve the subsequent page.
    ///
    /// When paginating, all other parameters provided to
    /// `SearchPrincipalAccessBoundaryPolicyBindingsRequest` must match the call
    /// that provided the page token.
    pub page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl SearchPrincipalAccessBoundaryPolicyBindingsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::SearchPrincipalAccessBoundaryPolicyBindingsRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::SearchPrincipalAccessBoundaryPolicyBindingsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::SearchPrincipalAccessBoundaryPolicyBindingsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }
}

impl wkt::message::Message for SearchPrincipalAccessBoundaryPolicyBindingsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.v3.SearchPrincipalAccessBoundaryPolicyBindingsRequest"
    }
}

/// Response message for SearchPrincipalAccessBoundaryPolicyBindings rpc.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SearchPrincipalAccessBoundaryPolicyBindingsResponse {
    /// The policy bindings that reference the specified policy.
    pub policy_bindings: std::vec::Vec<crate::model::PolicyBinding>,

    /// Optional. A token, which can be sent as `page_token` to retrieve the next
    /// page. If this field is omitted, there are no subsequent pages.
    pub next_page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl SearchPrincipalAccessBoundaryPolicyBindingsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [policy_bindings][crate::model::SearchPrincipalAccessBoundaryPolicyBindingsResponse::policy_bindings].
    pub fn set_policy_bindings<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::PolicyBinding>,
    {
        use std::iter::Iterator;
        self.policy_bindings = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::SearchPrincipalAccessBoundaryPolicyBindingsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }
}

impl wkt::message::Message for SearchPrincipalAccessBoundaryPolicyBindingsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.v3.SearchPrincipalAccessBoundaryPolicyBindingsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse
    for SearchPrincipalAccessBoundaryPolicyBindingsResponse
{
    type PageItem = crate::model::PolicyBinding;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.policy_bindings
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// An IAM principal access boundary policy resource.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PrincipalAccessBoundaryPolicy {
    /// Identifier. The resource name of the principal access boundary policy.
    ///
    /// The following format is supported:
    /// `organizations/{organization_id}/locations/{location}/principalAccessBoundaryPolicies/{policy_id}`
    pub name: std::string::String,

    /// Output only. The globally unique ID of the principal access boundary
    /// policy.
    pub uid: std::string::String,

    /// Optional. The etag for the principal access boundary.
    /// If this is provided on update, it must match the server's etag.
    pub etag: std::string::String,

    /// Optional. The description of the principal access boundary policy. Must be
    /// less than or equal to 63 characters.
    pub display_name: std::string::String,

    /// Optional. User defined annotations. See
    /// <https://google.aip.dev/148#annotations> for more details such as format and
    /// size limitations
    pub annotations: std::collections::HashMap<std::string::String, std::string::String>,

    /// Output only. The time when the principal access boundary policy was
    /// created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The time when the principal access boundary policy was most
    /// recently updated.
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Optional. The details for the principal access boundary policy.
    pub details: std::option::Option<crate::model::PrincipalAccessBoundaryPolicyDetails>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl PrincipalAccessBoundaryPolicy {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::PrincipalAccessBoundaryPolicy::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [uid][crate::model::PrincipalAccessBoundaryPolicy::uid].
    pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.uid = v.into();
        self
    }

    /// Sets the value of [etag][crate::model::PrincipalAccessBoundaryPolicy::etag].
    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.etag = v.into();
        self
    }

    /// Sets the value of [display_name][crate::model::PrincipalAccessBoundaryPolicy::display_name].
    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.display_name = v.into();
        self
    }

    /// Sets the value of [annotations][crate::model::PrincipalAccessBoundaryPolicy::annotations].
    pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [create_time][crate::model::PrincipalAccessBoundaryPolicy::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::PrincipalAccessBoundaryPolicy::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::PrincipalAccessBoundaryPolicy::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::PrincipalAccessBoundaryPolicy::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [details][crate::model::PrincipalAccessBoundaryPolicy::details].
    pub fn set_details<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::PrincipalAccessBoundaryPolicyDetails>,
    {
        self.details = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [details][crate::model::PrincipalAccessBoundaryPolicy::details].
    pub fn set_or_clear_details<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::PrincipalAccessBoundaryPolicyDetails>,
    {
        self.details = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for PrincipalAccessBoundaryPolicy {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.v3.PrincipalAccessBoundaryPolicy"
    }
}

/// Principal access boundary policy details
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PrincipalAccessBoundaryPolicyDetails {
    /// Required. A list of principal access boundary policy rules. The number of
    /// rules in a policy is limited to 500.
    pub rules: std::vec::Vec<crate::model::PrincipalAccessBoundaryPolicyRule>,

    /// Optional.
    /// The version number (for example, `1` or `latest`) that indicates which
    /// permissions are able to be blocked by the policy. If empty, the PAB policy
    /// version will be set to the most recent version number at the time of the
    /// policy's creation.
    pub enforcement_version: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl PrincipalAccessBoundaryPolicyDetails {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [rules][crate::model::PrincipalAccessBoundaryPolicyDetails::rules].
    pub fn set_rules<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::PrincipalAccessBoundaryPolicyRule>,
    {
        use std::iter::Iterator;
        self.rules = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [enforcement_version][crate::model::PrincipalAccessBoundaryPolicyDetails::enforcement_version].
    pub fn set_enforcement_version<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.enforcement_version = v.into();
        self
    }
}

impl wkt::message::Message for PrincipalAccessBoundaryPolicyDetails {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.v3.PrincipalAccessBoundaryPolicyDetails"
    }
}

/// Principal access boundary policy rule that defines the resource boundary.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PrincipalAccessBoundaryPolicyRule {
    /// Optional. The description of the principal access boundary policy rule.
    /// Must be less than or equal to 256 characters.
    pub description: std::string::String,

    /// Required. A list of Resource Manager resources. If a resource is listed in
    /// the rule, then the rule applies for that resource and its descendants. The
    /// number of resources in a policy is limited to 500 across all rules in the
    /// policy.
    ///
    /// The following resource types are supported:
    ///
    /// * Organizations, such as
    ///   `//cloudresourcemanager.googleapis.com/organizations/123`.
    /// * Folders, such as `//cloudresourcemanager.googleapis.com/folders/123`.
    /// * Projects, such as `//cloudresourcemanager.googleapis.com/projects/123`
    ///   or `//cloudresourcemanager.googleapis.com/projects/my-project-id`.
    pub resources: std::vec::Vec<std::string::String>,

    /// Required. The access relationship of principals to the resources in this
    /// rule.
    pub effect: crate::model::principal_access_boundary_policy_rule::Effect,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl PrincipalAccessBoundaryPolicyRule {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [description][crate::model::PrincipalAccessBoundaryPolicyRule::description].
    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.description = v.into();
        self
    }

    /// Sets the value of [resources][crate::model::PrincipalAccessBoundaryPolicyRule::resources].
    pub fn set_resources<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.resources = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [effect][crate::model::PrincipalAccessBoundaryPolicyRule::effect].
    pub fn set_effect<
        T: std::convert::Into<crate::model::principal_access_boundary_policy_rule::Effect>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.effect = v.into();
        self
    }
}

impl wkt::message::Message for PrincipalAccessBoundaryPolicyRule {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.v3.PrincipalAccessBoundaryPolicyRule"
    }
}

/// Defines additional types related to [PrincipalAccessBoundaryPolicyRule].
pub mod principal_access_boundary_policy_rule {
    #[allow(unused_imports)]
    use super::*;

    /// An effect to describe the access relationship.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Effect {
        /// Effect unspecified.
        Unspecified,
        /// Allows access to the resources in this rule.
        Allow,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [Effect::value] or
        /// [Effect::name].
        UnknownValue(effect::UnknownValue),
    }

    #[doc(hidden)]
    pub mod effect {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl Effect {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Allow => std::option::Option::Some(1),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("EFFECT_UNSPECIFIED"),
                Self::Allow => std::option::Option::Some("ALLOW"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for Effect {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for Effect {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for Effect {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Allow,
                _ => Self::UnknownValue(effect::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for Effect {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "EFFECT_UNSPECIFIED" => Self::Unspecified,
                "ALLOW" => Self::Allow,
                _ => Self::UnknownValue(effect::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for Effect {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Allow => serializer.serialize_i32(1),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for Effect {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Effect>::new(
                ".google.iam.v3.PrincipalAccessBoundaryPolicyRule.Effect",
            ))
        }
    }
}
